package com.ymm.platform.dao.rpc.impl;

import com.ymm.platform.dao.rpc.SystemRPC;
import com.ymm.system.api.dto.OrderAndCargoInfoResponse;
import com.ymm.system.api.facade.SystemShipperOrderService;
import com.ymm.system.api.utils.Result;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Component;


/**
 * @Description: 系统RPC服务实现
 * @Author: Xuecheng Li
 * @CreateTime: 2022-08-15 13:03
 * @Version: 1.0.0
 */
@Component
public class SystemRPCImpl implements SystemRPC {

    /**
     * 系统rpc实服务
     */
    @Reference(version = "server")
    SystemShipperOrderService systemShipperOrderService;

    /**
     * 获取指定订单包含货源详情
     *
     * @param orderId
     * @Param: [orderId]
     * @return: com.ymm.system.api.dto.ShipperOrderDetailResponse
     */
    @Override
    public OrderAndCargoInfoResponse getOrderAndCargoInfo(Long orderId) {
        Result<OrderAndCargoInfoResponse> orderDetail = systemShipperOrderService.getOrderAndCargoInfoByOrderId(orderId);
        return orderDetail.getData();
    }
}
